package org.jwd.storage.service;

import org.jwd.core.anno.auth.NeedPermissions;
import org.jwd.storage.dao.RollbackMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * @author vizz
 * @since 2022/5/19 17:22
 * <p>
 * 目前来看，回滚是没有任何保障的，而且没有加乐观锁。
 * 后续可以在这里进行加强
 */
@Service
public class RollbackService {

    @Resource
    RollbackMapper rollbackMapper;

    @NeedPermissions({"admin:rollback-insert","admin:rollback-all"})
    public int rollInsert(HashMap<String, String> map, String tableName) {
        return rollbackMapper.rollInsert(map, tableName);
    }

    public int rollDelete(HashMap<String, String> map, String tableName) {
        return rollbackMapper.rollDelete(map, tableName);
    }

    public int rollUpdate(HashMap<String, String> map, String tableName) {
        return rollbackMapper.rollUpdate(map, tableName);
    }


}
